Total streams: {{=len_stream}}
Total files: {{=len_configfile}}
{{
queued=processedfile.find(lambda r:r.status=='queued')
completed=processedfile.find(lambda r:r.status=='completed')
processing=processedfile.find(lambda r:r.status=='processing')
failed=processedfile.find(lambda r:r.status=='failed')
norm=100.0/(len(processedfile)+1)
p1=norm*len(queued)
p2=norm*len(completed)
k3=len(processing)
avtime=sum((f.completed_processing_on-f.posted_on).seconds for f in completed)/(len(completed)+1)
}}
Queued:{{='%5.2f%%' % p1}}
Completed:{{='%5.2f%%' % p2}}
Average Time:
{{=avtime}}secs
Status: {{='busy' if k3 else 'idle'}}

<table style="width: 100%">
  <thead>
    <tr>
      <th width="55px">Status</th>
      <th width="130px">Name</th>
      <th width="80px">Stream</th>
      <th width="120px">Created on</th>
      <th width="115px">Created by</th>
    </tr>
  </thead>
  <tbody>
    {{for records in (processing, failed, queued, completed):}}
    {{for f in records:}}
    <tr>
      <td width="60px">{{=f.status}}</td>
      <td width="130px">{{=f.configfile.filename}}</td>
      <td width="90px">{{=f.configfile.stream.name}}</td>
      <td width="130px">{{=f.posted_on}}</td>
      <td width="110px">{{=f.posted_by.first_name}} {{=f.posted_by.last_name}}</td>
    </tr>
    {{pass}}
    {{pass}}    
  </tbody>
</table>
